package com.farm.learn.domain.ex;

import com.farm.core.time.TimeTool;

/**
 * 用来记录用户课件的实时播放信息
 * 
 * @author macpl
 *
 */
public class PlayInfo {
	private String key;// 索引key（用户+课件+日）
	private String userkey;
	private String hourid;
	private String daytime8;// 统计周期到日
	// ---------------------------------------------
	private String livetime12 = "000000000000";// 刷新时间（到分）
	private int allPlayMinute = 0;// 当日累计播放时间（单位分）
	// 当前播放到的位置
	private int curentProcess = 0;

	public PlayInfo(String userkey, String hourid, String daytime8) {
		super();
		this.userkey = userkey;
		this.hourid = hourid;
		this.daytime8 = daytime8;
		this.key = getKey(userkey, hourid, daytime8);
		this.curentProcess = 0;
	}

	

	public int getCurentProcess() {
		return curentProcess;
	}



	public void setCurentProcess(int curentProcess) {
		this.curentProcess = curentProcess;
	}



	public static String getKey(String userkey, String hourid, String daytime8) {
		return userkey + hourid + daytime8;
	}

	/**
	 * 记录播放时间（建议1分钟）
	 * 
	 * @param minute
	 */
	public void playing(int minute) {
		if (!livetime12.equals(TimeTool.getTimeDate12())) {
			allPlayMinute = allPlayMinute + minute;
			livetime12 = TimeTool.getTimeDate12();
		}
	}

	public String getKey() {
		return key;
	}

	public String getUserkey() {
		return userkey;
	}

	public String getHourid() {
		return hourid;
	}

	public String getLivetime12() {
		return livetime12;
	}

	public String getDaytime8() {
		return daytime8;
	}

	public int getAllPlayMinute() {
		return allPlayMinute;
	}

}
